<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of soaUsers
 *
 * @author dxx
 */

namespace app\common\model\oms;

use think\Model;

class Brands extends Model {

    protected $table = 'brands';
    protected $connection = ['database' => 'oms'];
    
    /**
     * 获取当前多条数据
     * @param type $condition
     * @return type
     */
    public function getMutli($condition=[]){
        return $this->where($condition)->column("*");
    }
    
    /**
     * 根据条件获取一条记录
     * @param type $condition
     */
    public function getOne($condition) {
        return $this->where($condition)->find();
    }
    
    /**
     * 根据条件获取分页信息
     * @param type $condition
     * @param type $is_count
     * @param type $page
     * @param type $pageSize
     * @param type $order
     * @return type
     */
    public function getPage($condition,$is_count,$page = 0,$pageSize = 0,$order = ''){
        
        $this->where($condition);
        
        if($is_count == true){
            return $this->count();
        }
        
        if($order){
            $this->order($order);
        }
        
        return $this->page($page,$pageSize)->select();
    }
}
